/*
 * Copyright 2013-2019 Xia Jun(3979434@qq.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ***************************************************************************************
 *                                                                                     *
 *                        Website : http://www.farsunset.com                           *
 *                                                                                     *
 ***************************************************************************************
 */
package com.workcell.workdata.im.model.request;

import com.workcell.workdata.im.annotation.CreateAction;
import com.workcell.workdata.im.entity.Comment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

@ApiModel
public class CommentRequest implements Serializable {

	@NotNull(message = "momentId不能为空",groups = CreateAction.class)
	@ApiModelProperty("朋友圈文章ID")
	private Long momentId;

	@ApiModelProperty("父评论ID")
	private Long parentId;

	@ApiModelProperty("内容")
	@Length(max = 320,message = "内存不能超过320个字符",groups = CreateAction.class)
	private String content;

	@NotNull(message = "type不能为空",groups = CreateAction.class)
	@ApiModelProperty("类型")
	private Integer type;

	public Long getMomentId() {
		return momentId;
	}

	public void setMomentId(Long momentId) {
		this.momentId = momentId;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Comment ofComment(){

		Comment comment = new Comment();
		comment.setContent(content);
		comment.setType(type.byteValue());
		comment.setMomentId(momentId);
		comment.setParentId(parentId);

		return comment;
	}
}
